package com.bruce.starts.demo.test.threadlocal;

import java.util.ArrayList;

public class ADemo {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            ArrayList<A> list = new ArrayList<>();
            list.add(new A("a"));
            list.add(new A("b"));
            list.add(new A("c"));
            list.forEach(A::checkAndBuild);
            list.forEach(a-> System.out.println(a.getName()+":"+a.getSeq()));
        });

        Thread t2 = new Thread(()->{
            ArrayList<A> list = new ArrayList<>();
            list.add(new A("d"));
            list.add(new A("e"));
            list.add(new A("f"));
            list.forEach(A::checkAndBuild);
            list.forEach(a-> System.out.println(a.getName()+":"+a.getSeq()));
        });

        t1.start();
        Thread.sleep(500);
        t2.start();
    }
}
